<template>
	<view class="search">
		<view class='search-temp'>
				<view class="search-box">
					<view class="searchImg iconfont">
						&#xe65a;
					</view>
					<input class="searchInp" style="text-align: left;" type="text" value="" v-model="inpContent" @blur="searchKey" @focus="clear"/>
					<view class="clear iconfont" style="display: none;">
						&#xe60a;
					</view>
				</view>
		
			</view>
	</view>
	
</template>

<script>
	export default {
		name: "search-temp",
		data() {
			return {
				inpContent:	uni.getStorageSync('searchPlaceholderText')
			}
		},
		methods:{
			searchKey(){
				// console.log(this.inpContent)
				 this.$emit('childByValue', this.inpContent)
				 if(this.inpContent == '') {
					 this.inpContent = 	uni.getStorageSync('searchPlaceholderText')
				 }
			},
			clear() {
				this.inpContent = ''
			}	
		}
	}
</script>

<style>
	.search{
		width: 100%;
	}
	.search-temp {
		
		padding: 20upx;
		
		
	}

	.search-box {
		height: 70upx;
		background: white;
		/* display: flex;
		flex-direction: row;
		align-items: center; */
		position: relative;
		border-radius: 30upx;
		
	}

	.searchImg,
	.clear {

		margin: 0 20upx
	}
	.searchImg {
		width: 17upx;
		height: 17upx;
		position: absolute;
		left: 10upx;
		top: 20upx;
	}
	.searchInp {
		width: 600upx;
		/* flex: 1; */
		padding: 0;
		position: absolute;
		left: 80upx;
		top: 10upx;
		
	}
</style>
